package com.sunnada.edu.system.sysmodule.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;


@Repository
public class ModuleDaoImpl extends BaseDaoImpl implements ModuleDao {

	@Override
	public int getModuleCots(HashMap<String, String> params) {
		List list = selectList("module_sqlmap.getModuleCots", params);
		if(list!=null&&list.size()>0){
			String cot = ((Map)list.get(0)).get("cot")+"";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findModules(HashMap<String, String> params) {
		return selectList("module_sqlmap.findModules", params);
	}

	@Override
	public int moduleDel(HashMap<String, String> params) {
		return delete("module_sqlmap.moduleDel", params);
	}

	@Override
	public int moduleAdd(HashMap<String, String> params) {
		return insert("module_sqlmap.moduleAdd",params);
	}

	@Override
	public int moduleUpdate(HashMap<String, String> params) {
		return update("module_sqlmap.moduleUpdate",params);
	}

	@Override
	public Map getModuleByRecId(HashMap<String, String> params) {
		List list = selectList("module_sqlmap.getModuleByRecId", params);
		if(list!=null&&list.size()>0){
			return (Map)list.get(0);
		}
		return null;
	}

	@Override
	public List moduleTree(HashMap<String, String> params) {
		return selectList("module_sqlmap.moduleTree", params);
	}

	@Override
	public List moduleTree2(HashMap<String, String> params) {
		return selectList("module_sqlmap.moduleTree2", params);
	}
	
	@Override
	public List moduleTree3(HashMap<String, String> params) {
		return selectList("module_sqlmap.moduleTree3", params);
	}


	@Override
	public int moduleEnable(HashMap<String, String> params) {
		return update("module_sqlmap.moduleEnable", params);
	}

	@Override
	public int moduleDisable(HashMap<String, String> params) {		
		return update("module_sqlmap.moduleDisable", params);
	}

	@Override
	public List judgeHasLeaf(HashMap<String, String> params) {
		return selectList("module_sqlmap.judgeHasLeaf", params);
	}
}
